Copy of MainForm.cs
Description du code
Copy of MainForm.cs est un fichier du projet BiblioBrol.Ce fichier est situé dans /var/www/bin/sniplets/bibliobrol/src/.
Projet BiblioBrol :
Gestion de media en CSharp.
Pour plus d'infos, vous pouvez consulter la brève analyse.
Code source ou contenu du fichier
Code c# (Copy of MainForm.cs) (723 lignes)
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using be.gaudry.view; using be.gaudry.explorer.view; using be.gaudry.model.config; using be.gaudry.observer; using be.gaudry.bibliobrol.view.dialogs; using be.gaudry.bibliobrol.view.wizards; using be.gaudry.exceptions; using be.gaudry.view.dialogs; using be.gaudry.view.docking; namespace be.gaudry.bibliobrol.view { public partial class MainForm : DockParentForm { #region declarations and constructors private String hideCons, dispCons; private ConsoleForm consoleForm; private AboutBibliobrolDialog aboutBox; private ToolStripMenuItem showHideQuickLaunchTsMi; private ToolStripMenuItem personsTsMi, personsFormMenuItem, addUserTsMi; private ToolStripMenuItem brolsTsMi, brolsFormTSMenuItem, openEditSeriesForm; private ToolStripMenuItem mediabrolsTSMenuItem, mediabrolsFormTSMenuItem; private ToolStripMenuItem findTsMi, searchOnDiscTsMi, findOnDiscTsMi, findAwsTsMi; private ToolStripMenuItem openOldApplicationTsMi; private ToolStripMenuItem statsTSMenuItem, brolExplorerTSMenuItem, tasksTsMi, consoleTSMenuItem, hideConsoleTSMenuItem, clearConsoleTSMenuItem, consoleOpacityTSMenuItem, consoleOpacity50TSMenuItem, consoleOpacity70TSMenuItem, consoleOpacity90TSMenuItem, consoleOpacity95TSMenuItem, consoleOpacity100TSMenuItem; private ToolStripMenuItem misesÀJourToolStripMenuItem, welcomeWizardTSMenuItem; public MainForm() { StaticObservable.hideErrors(); InitializeComponent(); Splasher.Status = "Initialisation des composants BiblioBrol"; initMainFormFeatures(); Splasher.Status = "Initialisation de la console"; initConsoleForm(); Splasher.Status = "Initialisation de la config"; testApplicationConfig(); this.ResumeLayout(false); this.PerformLayout(); StaticObservable.showErrors(); } private void initMainFormFeatures() { // // personsTsMi // personsTsMi.DropDownItems.AddRange( { personsFormMenuItem, addUserTsMi }); personsTsMi.MergeAction = MergeAction.MatchOnly; personsTsMi.Name = "personsTsMi"; personsTsMi.Text = "&Personnes"; personsTsMi.ToolTipText = "Gestion des personnes (utilisateurs de l\'application, acteurs, dessinateurs, écrivains, etc.)"; // // personsFormMenuItem // personsFormMenuItem.Image = global::be.gaudry.bibliobrol.Properties.Resources.brolUsrs; personsFormMenuItem.Name = "personsFormMenuItem"; personsFormMenuItem.Text = "&Gérer les personnes"; mainMenuStrip.Items.Insert(1, personsTsMi); // // addUserTsMi // addUserTsMi.Image = global::be.gaudry.bibliobrol.Properties.Resources.brolUsrAddBtn; addUserTsMi.Name = "addUserTsMi"; addUserTsMi.Text = "Ajouter un utilisateur"; //addUserTsMi.Click += new System.EventHandler(showUserFormAction); // // displayMenuLeftTsB // displayMenuLeftTsB.Visible = true; displayMenuLeftTsB.Text = "Afficher ou masquer la barre de lancement rapide"; displayMenuLeftTsB.AutoToolTip = true; // // showHideQuickLaunchTsMi // showHideQuickLaunchTsMi.Image = global::be.gaudry.Properties.Resources.displayMenuLeft; showHideQuickLaunchTsMi.Name = "showHideQuickLaunchTsMi"; showHideQuickLaunchTsMi.Text = "Lancement rapide"; displayToolBarTsMi.DropDownItems.Add(showHideQuickLaunchTsMi); // // brolsTsMi // brolsTsMi.DropDownItems.AddRange( { brolsFormTSMenuItem, openEditSeriesForm }); brolsTsMi.Name = "brolsTsMi"; brolsTsMi.Text = "&Ouvrages"; brolsTsMi.ToolTipText = "Gestion des ouvrages. "+ "(Rappel : un ouvrage est un type générique, ce que vous possédez, ce sont des exemplaires)"; mainMenuStrip.Items.Insert(1, brolsTsMi); // // brolsFormTSMenuItem // brolsFormTSMenuItem.Image = global::be.gaudry.bibliobrol.Properties.Resources.brolSmall; brolsFormTSMenuItem.MergeAction = MergeAction.Insert; brolsFormTSMenuItem.Name = "brolsFormTSMenuItem"; brolsFormTSMenuItem.Text = "&Gérer les ouvrages"; // // openEditSeriesForm // openEditSeriesForm.Name = "openEditSeriesForm"; openEditSeriesForm.Text = "Gérer les séries"; // // mediabrolsTSMenuItem // mediabrolsTSMenuItem.DropDownItems.Add(mediabrolsFormTSMenuItem); mediabrolsTSMenuItem.Name = "mediabrolsTSMenuItem"; mediabrolsTSMenuItem.Text = "E&xemplaires"; mediabrolsTSMenuItem.ToolTipText = "Gérer les exemplaires (localisation, état, propriétaire, emprunts)"; mainMenuStrip.Items.Insert(1, mediabrolsTSMenuItem); // // mediabrolsFormTSMenuItem // mediabrolsFormTSMenuItem.Image = global::be.gaudry.bibliobrol.Properties.Resources.mediabrolSmall; mediabrolsFormTSMenuItem.MergeAction = MergeAction.MatchOnly; mediabrolsFormTSMenuItem.Name = "mediabrolsFormTSMenuItem"; mediabrolsFormTSMenuItem.Text = "&Gérer les exemplaires"; // // findTsMi // findTsMi.DropDownItems.AddRange( { searchOnDiscTsMi, findOnDiscTsMi, findAwsTsMi }); findTsMi.Name = "findTsMi"; findTsMi.Text = "&Recherche"; mainMenuStrip.Items.Insert(1, findTsMi); // // searchOnDiscTsMi // searchOnDiscTsMi.Name = "searchOnDiscTsMi"; searchOnDiscTsMi.Text = "Sur le disque (Automatique)"; // // findOnDiscTsMi // findOnDiscTsMi.Name = "findOnDiscTsMi"; findOnDiscTsMi.Text = "Sur le disque (Explorer)"; // // findAwsTsMi // findAwsTsMi.Name = "findAwsTsMi"; findAwsTsMi.Text = "Bases de données Internet"; // // openOldApplicationTsMi // openOldApplicationTsMi.Image = global::be.gaudry.bibliobrol.Properties.Resources.brolWindows; openOldApplicationTsMi.Name = "openOldApplicationTsMi"; openOldApplicationTsMi.Text = "Ancienne version"; openOldApplicationTsMi.ToolTipText = "Fermer cette fenêtre et ouvrir l'ancienne version"; windowTsMi.DropDownItems.Add(openOldApplicationTsMi); // // toolsTsMi // toolsTsMi.DropDownItems.AddRange( { statsTSMenuItem, brolExplorerTSMenuItem, tasksTsMi, consoleTSMenuItem }); // // statsTSMenuItem // statsTSMenuItem.Image = global::be.gaudry.bibliobrol.Properties.Resources.statsSmall; statsTSMenuItem.Name = "statsTSMenuItem"; statsTSMenuItem.Text = "Statistiques"; statsTSMenuItem.ToolTipText = "Affichage de certaines informations sous forme de tartes"; // // brolExplorerTSMenuItem // brolExplorerTSMenuItem.Name = "brolExplorerTSMenuItem"; brolExplorerTSMenuItem.Text = "Explorateur de media"; // // tasksTsMi // tasksTsMi.Name = "tasksTsMi"; tasksTsMi.Text = "Tâches"; // // consoleTSMenuItem // consoleTSMenuItem.DropDownItems.AddRange( { hideConsoleTSMenuItem, clearConsoleTSMenuItem, consoleOpacityTSMenuItem }); consoleTSMenuItem.Image = global::be.gaudry.bibliobrol.Properties.Resources.brolConsole; consoleTSMenuItem.Name = "consoleTSMenuItem"; consoleTSMenuItem.Text = "&Console"; consoleTSMenuItem.ToolTipText = "Gestion de la console locale"; // // hideConsoleTSMenuItem // hideConsoleTSMenuItem.Image = global::be.gaudry.bibliobrol.Properties.Resources.brolConsoleHide; hideConsoleTSMenuItem.Name = "hideConsoleTSMenuItem"; hideConsoleTSMenuItem.Text = "Montrer/Cacher la console"; hideConsoleTSMenuItem.ToolTipText = "Afficher ou masquer la console"; // // clearConsoleTSMenuItem // clearConsoleTSMenuItem.Image = global::be.gaudry.bibliobrol.Properties.Resources.brolConsoleClean; clearConsoleTSMenuItem.Name = "clearConsoleTSMenuItem"; clearConsoleTSMenuItem.Text = "Vider la console"; clearConsoleTSMenuItem.ToolTipText = "Réinitialiser le contenu de la console"; // // consoleOpacityTSMenuItem // consoleOpacityTSMenuItem.DropDownItems.AddRange( { consoleOpacity50TSMenuItem, consoleOpacity70TSMenuItem, consoleOpacity90TSMenuItem, consoleOpacity95TSMenuItem, consoleOpacity100TSMenuItem }); consoleOpacityTSMenuItem.Image = global::be.gaudry.bibliobrol.Properties.Resources.brolConsoleOp; consoleOpacityTSMenuItem.Name = "consoleOpacityTSMenuItem"; consoleOpacityTSMenuItem.Text = "Opacité"; // // consoleOpacity50TSMenuItem // consoleOpacity50TSMenuItem.Image = global::be.gaudry.bibliobrol.Properties.Resources.brolConsoleOp50; consoleOpacity50TSMenuItem.Name = "consoleOpacity50TSMenuItem"; consoleOpacity50TSMenuItem.Text = "50 %"; // // consoleOpacity70TSMenuItem // consoleOpacity70TSMenuItem.Image = global::be.gaudry.bibliobrol.Properties.Resources.brolConsoleOp70; consoleOpacity70TSMenuItem.Name = "consoleOpacity70TSMenuItem"; consoleOpacity70TSMenuItem.Text = "70 %"; // // consoleOpacity90TSMenuItem // consoleOpacity90TSMenuItem.Image = global::be.gaudry.bibliobrol.Properties.Resources.brolConsoleOp90; consoleOpacity90TSMenuItem.Name = "consoleOpacity90TSMenuItem"; consoleOpacity90TSMenuItem.Text = "90 %"; // // consoleOpacity95TSMenuItem // consoleOpacity95TSMenuItem.Image = global::be.gaudry.bibliobrol.Properties.Resources.brolConsoleOp95; consoleOpacity95TSMenuItem.Name = "consoleOpacity95TSMenuItem"; consoleOpacity95TSMenuItem.Text = "95 %"; // // consoleOpacity100TSMenuItem // consoleOpacity100TSMenuItem.Image = global::be.gaudry.bibliobrol.Properties.Resources.brolConsoleOp; consoleOpacity100TSMenuItem.Name = "consoleOpacity100TSMenuItem"; consoleOpacity100TSMenuItem.Text = "100 %"; // // helpTsMi // helpTsMi.DropDownItems.AddRange( { misesÀJourToolStripMenuItem, welcomeWizardTSMenuItem }); // // misesÀJourToolStripMenuItem // misesÀJourToolStripMenuItem.Name = "misesÀJourToolStripMenuItem"; misesÀJourToolStripMenuItem.Text = "Mises à jour..."; // // welcomeWizardTSMenuItem // welcomeWizardTSMenuItem.Image = global::be.gaudry.bibliobrol.Properties.Resources.wizardSmall; welcomeWizardTSMenuItem.Name = "welcomeWizardTSMenuItem"; welcomeWizardTSMenuItem.Text = "Assistant de démarrage"; welcomeWizardTSMenuItem.ToolTipText = "Assistant pas à pas pour configurer l\'application (localisation des répertoires, " + "de la DB, etc.)"; // // contentsTSMenuItem // //contentsTSMenuItem.Click += new System.EventHandler(this.showWelcomeWizardAction); // // indexTSMenuItem // //indexTSMenuItem.Click += new System.EventHandler(this.showWelcomeWizardAction); // // searchToolStripMenuItem // //searchToolStripMenuItem.Click += new System.EventHandler(this.showWelcomeWizardAction); // // aboutTSMenuItem // aboutTSMenuItem.Text = "À &propos de Bibliobrol..."; } #endregion #region open childs private void personsTSB_Click(object sender, EventArgs e) { StaticObservable.hideErrors(); showMDIChild<ActorForm>("Chargement des personnes"); StaticObservable.showErrors(); } private void brolsTSB_Click(object sender, EventArgs e) { showMDIChild<BrolForm>("Chargement des ouvrages"); } private void mediabrolsTSB_Click(object sender, EventArgs e) { showMDIChild<MediabrolForm>("Chargement des exemplaires"); } private void statsTSB_Click(object sender, EventArgs e) { showMDIChild<StatsForm>("Chargement des statistiques"); } private void openEditSeriesForm_Click(object sender, EventArgs e) { showMDIChild<EditSeriesForm>("Chargement des séries"); } private void showAwsFormAction(object sender, EventArgs e) { showMDIChild<AWSForm>("Chargement du service de recherche"); } private void showTasksFormAction(object sender, EventArgs e) { showMDIChild<TasksForm>("Chargement des tâches"); } private void brolXplorerTSB_Click(object sender, EventArgs e) { showBrolExplorerForm(true); } private void brolXplorerSearchTSB_Click(object sender, EventArgs e) { showBrolExplorerForm(false); } private void showBrolExplorerForm(bool explore) { //todo : ensure single instance of view ExplorerForm brolExplorerForm = createMDIChild<ExplorerForm>(); if (explore) { brolExplorerForm.openExplorer(); } else { brolExplorerForm.openMediaBrowser(); } showMDIChild(brolExplorerForm); } private void showPhotobrolTSB_Click(object sender, EventArgs e) { if (PluginsManager.PhotoBrolPlugAvailable) { showMDIChild<be.gaudry.photobrol.view.PhotoBrolMainForm>("Chargement de l'éditeur d'images"); } } private void openOldMainFormTsBtn_Click(object sender, EventArgs e) { form.WindowState = this.WindowState; form.Location = this.Location; form.Width = this.Width; form.Height = this.Height; form.Show(); } #endregion #region Console private void initConsoleForm() { hideCons = "Cacher la console"; dispCons = "Afficher la console"; consoleForm.DockPanel = this.dockPanel; setStatusMessage(String.Format("Bibliobrol utilisé par {0}, dans la session de {1}", Config.Owner, Environment.UserName)); consoleForm.setStatusBar(toolStripStatusLabel); consoleForm.StartPosition = FormStartPosition.Manual; if (Config.ShowConsole) { //consoleForm.Show(this); consoleForm.Show(dockPanel); hideConsoleTSMenuItem.Text = hideCons; } else { hideConsoleTSMenuItem.Text = dispCons; } //consoleForm.MdiParent = this; consoleOpacity50TSMenuItem.Tag = 0.5; consoleOpacity70TSMenuItem.Tag = 0.7; consoleOpacity90TSMenuItem.Tag = 0.9; consoleOpacity95TSMenuItem.Tag = 0.95; consoleOpacity100TSMenuItem.Tag = 1.0; } private void dispConsTSB_Click(object sender, EventArgs e) { hideConsoleTSMenuItem_Click(sender, e); } private void cleanConsoleTSB_Click(object sender, EventArgs e) { clearConsoleTSMenuItem_Click(sender, e); } private void consoleTSMenuItem_Paint(object sender, PaintEventArgs e) { bool disp = Config.ShowConsole; consoleOpacityTSMenuItem.Enabled = disp; //clearConsoleTSMenuItem.Enabled = disp; clearConsoleTSMenuItem.Enabled = consoleForm!=null && (consoleForm.ConsoleCount > 0); setConsoleButtonsState(); } /// <summary> /// Set buttons images, toolstrip text, and enabled or not /// </summary> private void setConsoleButtonsState() { if (Config.ShowConsole) { hideConsoleTSMenuItem.Text = hideCons; hideConsoleTSMenuItem.Image = global::be.gaudry.bibliobrol.Properties.Resources.brolConsoleHide; dispConsTSB.ToolTipText = hideCons; dispConsTSB.Image = global::be.gaudry.bibliobrol.Properties.Resources.brolConsoleHide; } else { hideConsoleTSMenuItem.Text = dispCons; hideConsoleTSMenuItem.Image = global::be.gaudry.bibliobrol.Properties.Resources.brolConsole; dispConsTSB.ToolTipText = dispCons; dispConsTSB.Image = global::be.gaudry.bibliobrol.Properties.Resources.brolConsole; } cleanConsoleTSB.Enabled = clearConsoleTSMenuItem.Enabled; } private void clearConsoleTSMenuItem_Click(object sender, EventArgs e) { consoleForm.consoleClear(); } private void hideConsoleTSMenuItem_Click(object sender, EventArgs e) { Config.ShowConsole = !Config.ShowConsole; setConsoleButtonsState(); } #region Console Opacity private void consoleOpacityValTSMenuItem_Click(object sender, EventArgs e) { consoleForm.Opacity = (double)((ToolStripItem)sender).Tag; } private void consoleOpacityTSMenuItem_Paint(object sender, PaintEventArgs e) { foreach (ToolStripItem item in consoleOpacityTSMenuItem.DropDownItems) { item.Enabled = (!item.Tag.Equals(consoleForm.Opacity)); } } //Console Opacity #endregion //Console #endregion #region test application validity /// <summary> /// Try forms initializations. /// If no persistance available, a message is displayed, and the wizard is set as the first page. /// </summary> public void testApplicationConfig() { if (!System.IO.Directory.Exists(Config.DataDirPath)) { /*StringBuilder str = new StringBuilder("Impossible de trouver le répertoire de données de l'application ("); str.Append(Config.DataDirPath); str.Append(").\n\nIl est possible de modifier la configuration dans l'écran de configuration qui va s'afficher, ou dans le menu \"Outils/Options\""); StaticObservable.notify(new Notification(Notification.VERBOSE.opsResult, "Configuration Bibliobrol", str.ToString(), this)); */ enableApplication(false); } else { try { model.ModelAdapter.isAvailablePersistance(); enableApplication(true); } catch (PersistanceNotFoundException) { /*StringBuilder str = new StringBuilder(e.Message); str.AppendLine("\n\nIl est possible de modifier la configuration dans le menu \"Outils/Options\", puis sélectionner \"Persistance\"..."); str.AppendLine("\nAucune fonctionnalité de l'application ne sera disponible tant que le système de persistance ne sera défini."); str.AppendLine("Des messages d'erreur peuvent se présenter avant de configurer le système de persistance, ignorez les."); StaticObservable.notify(new Notification(Notification.VERBOSE.opsResult, "Configuration Bibliobrol", str.ToString(), this)); */ enableApplication(false); } } } /// <summary> /// Allow to use application buttons if data dir path and persistant are found /// </summary> /// <param name="enable"></param> private void enableApplication(bool enable) { //borrowsTSMenuItem.Visible = enable; brolsFormTSMenuItem.Visible = enable; personsFormMenuItem.Visible = enable; mediabrolsFormTSMenuItem.Visible = enable; statsTSMenuItem.Visible = enable; if (!enable) { wwf.MdiParent = this; wwf.WindowState = FormWindowState.Maximized; wwf.Show(); } } #endregion private void showWelcomeWizardAction(object sender, EventArgs e) { showMDIChild<WelcomeWizardForm>("Chargement des données pour l'assistant de démarrage"); } private void onShowUpdateForm_Click(object sender, EventArgs e) { } private void showHideQuickLaunch_Click(object sender, EventArgs e) { leftTSP.Visible = !leftTSP.Visible; //showHideStatusBarTsMi.Checked = statusStrip.Visible; } private void openAbout_Click(object sender, EventArgs e) { aboutBox.ShowDialog(this); } private void openOptions_Click(object sender, EventArgs e) { optionForm.Owner = this; optionForm.Show(); } #region form events #endregion } }
Structure et Fichiers du projet
Afficher/masquer...Icône | Nom | Taille | Modification |
Icône | Nom | Taille | Modification |
| _ | Répertoire parent | 0 octets | 1731625413 15/11/2024 00:03:33 |
| _ | wizards | 0 octets | 1541007184 31/10/2018 18:33:04 |
| _ | utils | 0 octets | 1541007184 31/10/2018 18:33:04 |
| _ | controls | 0 octets | 1541007178 31/10/2018 18:32:58 |
| _ | dialogs | 0 octets | 1541007183 31/10/2018 18:33:03 |
Utilisation de l'explorateur de code
- Navigation :
- Un clic sur une icône de répertoire ouvre ce répertoire pour en afficher les fichiers.
- Lorsque le répertoire en cours ne contient pas de sous-répertoires il est possible de remonter vers le répertoire parent.
- La structure de répertoires en treetable (tableau en forme d'arborescence) n'est plus possibledans cette version.
- Un clic sur une icône de fichier ouvre ce fichier pour en afficher le code avec la coloration syntaxique adaptée en fonction du langage principal utilisé dans le fichier.
- Affichage :
- Il est possible de trier les répertoires ou les fichiers selon certains critères (nom, taille, date).
- Actions :
- Les actions possible sur les fichiers dépendent de vos droits d'utilisateur sur le site. Veuillez activer le mode utilisateur pour activer les actions.
English translation
You have asked to visit this site in English. For now, only the interface is translated, but not all the content yet.If you want to help me in translations, your contribution is welcome. All you need to do is register on the site, and send me a message asking me to add you to the group of translators, which will give you the opportunity to translate the pages you want. A link at the bottom of each translated page indicates that you are the translator, and has a link to your profile.
Thank you in advance.
Document created the 16/10/2009, last modified the 26/10/2018
Source of the printed document:https://www.gaudry.be/en/cs-bibliobrol-source-rf-view/Copy%20of%20MainForm.cs.html
The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.